﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>A date range picker for Bootstrap</title>
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="css/daterangepicker.css" rel="stylesheet" type="text/css" />
    <script src="../jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
    <script src="js/moment-with-locales.min.js" type="text/javascript"></script>
    <script src="js/daterangepicker.js" type="text/javascript"></script>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class=" input-group">
                <input type="text" id="demo" class="form-control" value="">
                <span id="calendar" class=" input-group-addon"  style=" cursor:pointer;"><span class="glyphicon glyphicon-calendar fa fa-calendar"></span></span>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            moment.locale("zh_cn");
            $("#calendar").click(function () {
                $('#demo').click();
            });
            $('#demo').daterangepicker({
                autoUpdateInput: false,
                locale: {
                    format: 'YYYY-MM-DD',
                    separator: ',',
                    applyLabel: '确定',
                    cancelLabel: '清除'
                }
            }).on({
                "cancel.daterangepicker": function (e) {
                    $(this).val("");
                },
                "apply.daterangepicker": function (ev, picker) {
                    $(this).val(picker.startDate.format('YYYY-MM-DD') + ',' + picker.endDate.format('YYYY-MM-DD'));
                }
            });
        });
    </script>
</body>
</html>
